package br.com.basili.entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;

@Entity
public class Identification implements Serializable
{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	@Id
	@Column(name="IDENTIFICATION_ID")
	@GeneratedValue
	private int               id_identification;
	private String            title;
	private String            theme;
	private Date              startDate;
	private Date              endDate;
	@OneToMany( fetch = FetchType.EAGER )
	@JoinTable(name = "IDENTIFICATION_RESEARCHERS", 
	           joinColumns = {@JoinColumn(name="IDENTIFICATION_ID")}, 
	           inverseJoinColumns={@JoinColumn(name="RESEARCH_ID")})
	private List<Researcher> researchers = new ArrayList<Researcher>();
	@ManyToOne (cascade = CascadeType.ALL)
	private TechnicalArea         technicalArea;
	private String                affiliation;
	
	private String                  city;
	
	private String                 state;
	
	@OneToOne
	@JoinColumn( name = "cod_protocol", insertable = true, updatable = false  )
	private Protocol protocol;

	public Identification( String title, String theme, Date startDate,
			Date endDate )
	{
		this.title = title;
		this.theme = theme;
		this.startDate = startDate;
		this.endDate = endDate;
	}
	
	public Identification( )
	{
		// TODO Auto-generated constructor stub
	}

	public String getTitle( )
	{
		return title;
	}
	
	public void setTitle( String title )
	{
		this.title = title;
	}
	
	public String getTheme( )
	{
		return theme;
	}
	
	public void setTheme( String theme )
	{
		this.theme = theme;
	}
	
	public Date getStartDate( )
	{
		return startDate;
	}
	
	public void setStartDate( Date startDate )
	{
		this.startDate = startDate;
	}
	
	public Date getEndDate( )
	{
		return endDate;
	}
	
	public void setEndDate( Date endDate )
	{
		this.endDate = endDate;
	}

	public List<Researcher> getResearchers() {
		return researchers;
	}

	public void setResearchers(List<Researcher> researchers) {
		this.researchers = researchers;
	}

	public TechnicalArea getTechnicalArea() {
		return technicalArea;
	}

	public void setTechnicalArea(TechnicalArea technicalArea) {
		this.technicalArea = technicalArea;
	}

	public String getAffiliation() {
		return affiliation;
	}

	public void setAffiliation(String affiliation) {
		this.affiliation = affiliation;
	}

	public int getId_identification() {
		return id_identification;
	}

	public void setId_identification(int id_identification) {
		this.id_identification = id_identification;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	public Protocol getProtocol() {
		return protocol;
	}

	public void setProtocol(Protocol protocol) {
		this.protocol = protocol;
	}

}